﻿using System;
using System.Collections.Generic;
using System.Text;
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Security.Cryptography;

/// <summary>
/// Summary description for NhaSanXUatBUS
/// </summary>
public class NhaSanXuatBUS
{
    private NhaSanXuatDAO objNhaSanXuatDAO;
    public NhaSanXuatBUS(string strPath)
    {
        objNhaSanXuatDAO = new NhaSanXuatDAO(strPath);
    }
    public DataSet SelectNhaSanXuatAll()
    {
        DataSet ds;
        try
        {
            ds = objNhaSanXuatDAO.SelectNhaSanXuatAll();
            return ds;
        }
        catch (System.Exception e)
        {
            throw new Exception(e.Message, e.InnerException);
        }
    }

    public DataSet SelectNhaSanXuatLoaiSanPham()
    {
        DataSet ds;
        try
        {
            ds = objNhaSanXuatDAO.SelectNhaSanXuatLoaiSanPham();
            return ds;
        }
        catch (System.Exception e)
        {
            throw new Exception(e.Message, e.InnerException);
        }
    }

    public DataSet SelectNhaSanXuatByLoaiSanPham(int id)
    {
        DataSet ds;
        try
        {
            ds = objNhaSanXuatDAO.SelectNhaSanXuatByLoaiSanPham(id);
            return ds;
        }
        catch (System.Exception e)
        {
            throw new Exception(e.Message, e.InnerException);
        }
    }

    public DataSet SelectNhaSanXuat_AutoComplete(string input)
    {
        DataSet ds;
        try
        {
            ds = objNhaSanXuatDAO.SelectNhaSanXuat_AutoComplete(input);
            return ds;
        }
        catch (System.Exception e)
        {
            throw new Exception(e.Message, e.InnerException);
        }
    }


    public Boolean InsertNhaSanXuat(NhaSanXuatDTO nsx)
    {
        try
        {
            return objNhaSanXuatDAO.InsertNhaSanXuat(nsx);
        }
        catch (System.Exception e)
        {
            return false;
        }
    }

    public Boolean InsertNhaSanXuat_LoaiSP(string nsx, int loaisp)
    {
        try
        {
            return objNhaSanXuatDAO.InsertNhaSanXuat_LoaiSP(nsx, loaisp);
        }
        catch (System.Exception e)
        {
            return false;
        }
    }

    public Boolean UpdateNhaSanXuat(NhaSanXuatDTO nsx)
    {
        try
        {
            return objNhaSanXuatDAO.UpdateNhaSanXuat(nsx);
        }
        catch (System.Exception e)
        {
            return false;
        }
    }

    public Boolean DeleteNhaSanXuat(int id)
    {
        try
        {
            return objNhaSanXuatDAO.DeleteNhaSanXuat(id);
        }
        catch (System.Exception e)
        {
            return false;
        }
    }

    public DataSet SelectTenNSX(int id)
    {
        DataSet ds;
        try
        {
            ds = objNhaSanXuatDAO.SelectTenNSX(id);
            return ds;
        }
        catch (System.Exception e)
        {
            throw new Exception(e.Message, e.InnerException);
        }
    }
}